package com.imageflowpro.image_flow_pro.controller.admin;

import com.imageflowpro.image_flow_pro.dto.VerificationCodeDTO;
import com.imageflowpro.image_flow_pro.result.Result;
import com.imageflowpro.image_flow_pro.service.IVerificationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/verificationCode")
public class VerificationCodeController {
    @Autowired
    private IVerificationCodeService iVerificationCodeService;

    @GetMapping("/getVerificationCodeList")
    public Result<List<VerificationCodeDTO>> getVerificationCodeList(){
        return Result.success(iVerificationCodeService.adminGetVerificationCodeList());
    }

    @PostMapping("/createCode/{type}")
    public Result adminCreateCode(@PathVariable("type")String type) {
        iVerificationCodeService.adminCreateCode(type);
        return Result.success();
    }

    @DeleteMapping("/deleteById/{id}")
    public Result deleteVerificationCodeById(@PathVariable("id")Long codeId){
        iVerificationCodeService.adminDeleteVerificationCodeById(codeId);
        return Result.success();
    }

}
